<?php

namespace Remoteshell\PhpBotSdk\logger;

use Katzgrau\KLogger\Logger;

class LoggerRecoder
{

    private static $log;

    /**
     * 初始化
     */
    public function __construct(){
        $logPath = "./logs";
        self::$log = new Logger($logPath);
    }

    /**
     * @return Logger
     * 返回一个实例化好的Log对象
     */
    public static function getLog(): Logger{
        return self::$log;
    }

    /**
     * 记录函数
     * @return void
     */
    public function record(string $mode, string $message): void{
        switch ($mode){
            case "normal":
                self::$log->info($message);
                break;
            case "error":
                self::$log->error($message);
                break;
            case "warning":
                self::$log->warning($message);
                break;
            case "alert":
                self::$log->alert($message);
                break;
            case "critical":
                self::$log->critical($message);
                break;
            case "emergency":
                self::$log->emergency($message);
                break;
            case "debug":
                self::$log->debug($message);
                break;
            case "notice":
                self::$log->notice($message);
                break;
            default:
                self::$log->info($message);
        }
    }
}